<?php


class ApiSummary
{
    use util_array;

    public static function minute()
    {
        return  MsggSummary::builds([]);
    }

    public static function statistics_minute($params)
    {
        $ts = self::util_array_get($params, 'ts', time());
        $type =self::util_array_get($params,'type',null);
        $types = MsggItem::getOptions('type');
        if(empty($type) ||  !array_key_exists($type,$types))
        {
            return ['code' => 1, 'msg' => 'invalidate type'];
        }
        return MsggSummary::statistics($ts, $type, MsggSummary::DURATION_MINUTE);
    }

}